var caseIndex = $.getUrlParam('index') || 0;
function casesAjax(sucMethod) {
	var caseData = sessionStorage.caseData;
	if(caseData) {
		sucMethod(JSON.parse(caseData))
	} else {
		$.ajax({
			type: "get",
			url: serviceIP + "shemhe.php/Officials/cases",
			async: true,
			dataType: "json",
			success: sucMethod
		})
	}
}
function newsAjax(sucMethod) {
	var newsData = sessionStorage.newsData;
	if(newsData) {
		sucMethod(JSON.parse(newsData))
	} else {
		$.ajax({
			type: "get",
			url: serviceIP + "shemhe.php/Officials/news",
			async: true,
			dataType: "json",
			success: sucMethod
		})
	}
};
if($.getUrlParam('type') == "case") {
	casesAjax(detailCase);
} else {
	newsAjax(detailNews);
}
function detailCase(datas) {
	new Vue({
		el:'.mod-content',
		data: {
			oneitem: datas.result.case[caseIndex],
			subUrl: "about-brief.html",
			subNav: datas.result.navigation,
			ifcase: true,
			ifnews: false
		}
	});
}

function detailNews(datas) {
	console.log(datas);
	new Vue({
		el: '.mod-content',
		data: {
			oneitem: datas.result.news[caseIndex],
			subUrl: "about-brief.html",
			subNav: datas.result.navigation,
			ifcase: false,
			ifnews: true
		}
	});
}